import 'dart:convert';

import 'package:safetymonitor/generated/json/base/json_field.dart';
import 'package:safetymonitor/generated/json/user_profile_entity.g.dart';
export 'package:safetymonitor/generated/json/user_profile_entity.g.dart';

@JsonSerializable()
class UserProfileEntity {
  UserProfileEntity();

  factory UserProfileEntity.fromJson(Map<String, dynamic> json) => $UserProfileEntityFromJson(json);

  ///	用户编号
  late int id = 0;

  late int systemFlag = 0;

  ///	用户账号
  late String username = '';

  ///	用户昵称
  late String nickname = '';

  ///	用户邮箱
  late String email = '';

  ///	手机号码
  late String mobile = '';

  ///	用户性别，参见 SexEnum 枚举类
  late int sex = 0;

  ///	用户头像
  late String avatar = '';

  ///	最后登录 IP
  late String loginIp = '';

  ///	最后登录时间
  late String loginDate = '';

  ///	创建时间
  late String createTime = '';

  ///	管理后台 - 角色精简信息 Response VO
  late List<UserProfileRoles> roles = [];

  ///	管理后台 - 部门精简信息 Response VO
  late UserProfileDept dept = UserProfileDept();

  ///	管理后台 - 岗位信息的精简 Response VO
  late List<UserProfilePosts> posts = [];

  ///	社交用户
  late List<UserProfileSocialUsers> socialUsers = [];

  Map<String, dynamic> toJson() => $UserProfileEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class UserProfileRoles {
  UserProfileRoles();

  factory UserProfileRoles.fromJson(Map<String, dynamic> json) => $UserProfileRolesFromJson(json);
  late int id = 0;

  ///	角色名称
  late String name = '';

  Map<String, dynamic> toJson() => $UserProfileRolesToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class UserProfileDept {
  UserProfileDept();

  factory UserProfileDept.fromJson(Map<String, dynamic> json) => $UserProfileDeptFromJson(json);
  late int id = 0;

  ///	部门名称
  late String name = '';

  ///	父部门 ID
  late int parentId = 0;

  Map<String, dynamic> toJson() => $UserProfileDeptToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class UserProfilePosts {
  UserProfilePosts();

  factory UserProfilePosts.fromJson(Map<String, dynamic> json) => $UserProfilePostsFromJson(json);
  late int id = 0;

  ///	岗位名称
  late String name = '';

  Map<String, dynamic> toJson() => $UserProfilePostsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class UserProfileSocialUsers {
  UserProfileSocialUsers();

  factory UserProfileSocialUsers.fromJson(Map<String, dynamic> json) => $UserProfileSocialUsersFromJson(json);

  ///	社交平台的类型，参见 SocialTypeEnum 枚举类
  late int type = 0;

  ///	社交用户的 openid
  late String openid = '';

  Map<String, dynamic> toJson() => $UserProfileSocialUsersToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
